placesview: fix open action for locations without a mount or volume
authorRazvan Chitu <razvan.ch95@gmail.com>
Tue, 12 Jul 2016 09:08:23 +0000 (12:08 +0300)
committerRazvan Chitu <razvan.ch95@gmail.com>
Tue, 12 Jul 2016 09:56:04 +0000 (12:56 +0300)
In the "Other Locations" view, locations can be opened from the context menu
based on their mount or volume. However, some locations, like "Computer", do not
have either of those so they cannot be opened from the context menu. In order to
fix this, the file associated with the location can be used as well.

https://bugzilla.gnome.org/show_bug.cgi?id=768657

gtk/gtkplacesview.c

index de13d24488cfe4c9bba96ccdb4b3f821c7222a49..14e44cb31a761aad89c6218a6e02f75c526c1554 100644 (file)
@@ -1469,11 +1469,20 @@ get_view_and_file (GtkPlacesViewRow  *row,
       mount = gtk_places_view_row_get_mount (row);
 
       if (mount)
-        *file = g_mount_get_default_location (mount);
+        {
+          *file = g_mount_get_default_location (mount);
+        }
       else if (volume)
-        *file = g_volume_get_activation_root (volume);
+        {
+          *file = g_volume_get_activation_root (volume);
+        }
       else
-        *file = NULL;
+        {
+          *file = gtk_places_view_row_get_file (row);
+          if (*file) {
+            g_object_ref (*file);
+          }
+        }
     }
 }